ZiBaT => Peter Levinsky => Programming => exercise

SOAP
Consuming SOAP Web services

Updated : 2016-09-13

 

Exercise: Consuming SOAP based web services

Credit to Anders Bøjesson

Idea:Comsuming existing web services

Background:

w3schools -  Web Services Tutorial |  Introuction to WSDL |  SOAP Introduction
                          msdn -

The web site http://webservicex.com/new/Home/Index introduces a lot of relatively simple web services ready for consumption.

In this exercise you will make client applications for some of these web services.

Some of the services work - others don't.

General approach:

  1. Try the services in your browser before you start making a client application.
  2. Try the service in the soap-tester WcfTestClient
    (location on your computer : <<your visual studio home folder>>/common7/IDE e.g. 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE')
  3. Make a console application and 'add service reference' -> type in the wsdl file.
    make and object of the client, then you can call the method on this client object.

Exercise:

For each service your want to try

  1. Try the service in WcfTestClient
  2. make a simple program to consume the soap-service.

Some services to try

  1. Length Converter http://webservicex.com/New/Home/ServiceDetail/21
  2. Volume Converter http://webservicex.com/New/Home/ServiceDetail/32
  3. Statistics http://webservicex.com/New/Home/ServiceDetail/40
  4. Global weather http://webservicex.com/New/Home/ServiceDetail/56
  5. Others : http://webservicex.com/new/Home/Index

Extra: Sniff web service comunication with Fiddler or Wireshark

Before you run your program - start either Fiddler or Wireshark (see web-tools)

Investigate the http comunication after running your program.

Focus on http, xml and the xml encoded envelope.

Extra: Parse XML output

Some of the service methods return a long XML string.

Use the class XmlDocument to parse the XML string to get access to data inside the string.

Extra: GUI

Make a GUI include one (or more ...) of the web services you already tried.